package com.example.executor;

import com.example.thread.Callableimp;

import java.util.concurrent.*;

/**
 * @author mwh
 * @Description:
 * @date 2022/1/21 15:25
 */
public class MyExecutor {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        int corePoolSize =3;
        int maximumPoolSize = 10;
        long keepAliveTime = 10000;
        TimeUnit unit = TimeUnit.MILLISECONDS;
        BlockingQueue<Runnable> workQueue = new LinkedBlockingDeque<>(2);
        ExecutorService executorService = new ThreadPoolExecutor(
                 corePoolSize,
         maximumPoolSize,
         keepAliveTime,
         unit,
         workQueue
        );
        Future<String> future= executorService.submit(new Callableimp());
         String  obje= future.get();
        System.out.println("---------------"+obje);
    }


}
